package com.mobile.service.impl;

import com.mobile.service.dao.DaoSupport;
import com.mobile.service.entity.MessageNotification;
import com.mobile.service.entity.ProcessFlow;
import com.mobile.service.entity.WorkOrder;
import com.mobile.service.mapper.MessageNotificationMapper;
import com.mobile.service.mapper.ProcessFlowMapper;
import com.mobile.service.mapper.WorkOrderMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @Author : Gx
 * @Date: 2025/7/28 18:05
 * @Description:
 */
@Service
public class DataCommonService {

    @Resource(name = "daoSupport")
    private DaoSupport dao;

    @Resource
    private ProcessFlowMapper processFlowMapper;

    @Resource
    private WorkOrderMapper workOrderMapper;

    @Resource
    private MessageNotificationMapper messageNotificationMapper;

    @Transactional(rollbackFor = Exception.class)
    public void autoAssignTask(ProcessFlow processFlow, WorkOrder order, MessageNotification message) {

        processFlowMapper.insertProcessFlow(processFlow);

        //修改工单表状态
        workOrderMapper.updateWorkOrder(order);

        messageNotificationMapper.insertMessageNotification( message);


    }
}
